-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement idempotent soft delete for Books #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements idempotent soft delete functionality for the Book resource following TDD principles. The implementation marks books as deleted rather than physically removing them, supporting audit requirements and data recovery needs.
Key Changes:
- Added
deleteBookByIdmethod with idempotent behavior ensuring repeated deletions don't trigger unnecessary database writes - Comprehensive test coverage including success, not found, and idempotency scenarios
- Custom
ResourceNotFoundExceptionto handle business logic failures distinct from framework exceptions
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/codesungrape/hmcts/bookapi/service/BookService.java | Implements soft delete with @Transactional annotation and idempotent logic |
| src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java | Adds unit tests covering successful deletion, not found exception, and idempotency |
| src/main/java/com/codesungrape/hmcts/bookapi/exception/ResourceNotFoundException.java | New custom runtime exception for resource not found scenarios |
| build.gradle | Enhances JaCoCo report output with file path printing |
| README.md | Updates JaCoCo report file path to reflect actual location |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR implements the "Soft Delete" functionality for the Book resource using a TDD approach. It ensures data is marked as deleted rather than physically removed, supporting audit requirements and data recovery.
Changes:
Technical Decisions: